<template>
  <div>
<!-- 回复评论 -->
  <van-nav-bar
    :title="comment.reply_count?comment.reply_count+'条回复':'暂无回复'"
  @click-left="$emit('close')">
  <template #left>
    <van-icon name="cross" size="18"/>
  </template>
    </van-nav-bar>
  <commentitem :commentitem="comment"/>
  <van-cell title="全部回复" />
  <commentlist type="c" :source="comment.com_id + ''" :list="list"/>

  <div class="post-warp">
    <van-button @click="isShowReplyPostCommentPopup=true" round>评论</van-button>
  </div>

<van-popup @on-success="success" v-model="isShowReplyPostCommentPopup" position="bottom"  >
  <comment-post :target="comment.com_id + ''" :artId="$route.params.artId"/>
</van-popup >
</div>
  </template>

<script>
import commentitem from '@/views/Detail/components/commentitem'
import commentlist from './commentlist'
export default {
  props: {
    comment: {
      type: Object,
      required: true
    }
  },
  data () {
    return {
      list: [],
      isShowReplyPostCommentPopup: false

    }
  },
  components: {
    commentitem,
    commentlist
  },
  created () {

  },

  methods: {
    success (e) {
      this.list.unshift(e)
      this.isShowReplyPostCommentPopup = false
      this.comment.reply_count++
    }
  }
}
</script>

<style scoped lang='less'>
 .post-warp {
  width: 100%;
  height: 100px;
  position: fixed;
  bottom: 0;
  border-top: 1px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: hotpink;
  .van-button {
    width: 640px;
    height: 80px;
  }
}
</style>
